#!/usr/bin/env python3

import common

class Main(common.BuildCliFunction):
    def __init__(self):
        super().__init__(
            description='''\
https://cirosantilli.com/linux-kernel-module-cheat#secondary-disk
'''
        )

    def build(self):
        # We must clean first because mksquashfs tries to avoid overwrites
        # by renaming images on the target.
        self.clean()
        self.sh.run_cmd([
            'mksquashfs',
            self.env['out_rootfs_overlay_dir'],
            self.env['disk_image_2']
        ])

    def clean(self):
        self.sh.rmrf(self.env['disk_image_2'])

if __name__ == '__main__':
    Main().cli()
